Skip to content

feat(nix): integrate uv2nix for Python dependency management#88

Merged
ryoppippi merged 8 commits intomainfrom
feat/uv2nix-integration
Jan 3, 2026
Merged

feat(nix): integrate uv2nix for Python dependency management#88
ryoppippi merged 8 commits intomainfrom
feat/uv2nix-integration

Conversation

@ryoppippi
Copy link
Copy Markdown
Contributor

@ryoppippi ryoppippi commented Jan 3, 2026

Summary

Replaces uv-managed .venv with Nix-managed Python environments using uv2nix. This provides fully reproducible builds with dependencies cached in the Nix store.

What Changed

  • flake.nix: Add uv2nix, pyproject-nix, and pyproject-build-systems inputs
  • devShells: Create shells for Python 3.11 and 3.13 (default, python311, python313)
  • Build overrides: Add setuptools for pypika, editables for stackone-ai
  • CI: Update matrix to use nix develop .#pythonXXX instead of uv sync
  • setup-nix action: Simplify with gc-max-store-size: 4G for cache management
  • justfile: Add lint-fix alias

Why

  • Reproducibility: All dependencies are now managed by Nix store with hash-based caching
  • Faster CI: No need for uv sync step; dependencies are cached with other Nix derivations
  • Multi-version support: Easy to test against Python 3.11 and 3.13 via devShells
  • Backward compatible: uv run commands still work for non-Nix users

Notes

  • The .venv directory is no longer needed (can be deleted locally)
  • Use nix develop (default) or nix develop .#python313 for specific versions

Summary by cubic

Switches Python dependency management to Nix via uv2nix, replacing the uv-managed .venv. Builds are now reproducible, CI is faster with versioned, lockfile-scoped cache keys, and ty runs correctly in Nix shells via VIRTUAL_ENV.

  • New Features

    • Nix-managed envs from uv.lock using uv2nix; deps cached in the Nix store.
    • Dev shells and packages for Python 3.11 and 3.13 (default, python311, python313).
    • Build overrides: setuptools for pypika; editables for stackone-ai. CI uses nix develop .#pythonXXX with cache keys scoped by Python version and flake.lock/uv.lock; setup-nix restores per-version caches and limits store size.
  • Migration

    • Remove your local .venv. Use nix develop (or nix develop .#python313) for a specific version.
    • uv run still works for non-Nix users; commands auto-prefix uv outside Nix shells.

Written for commit 10475d3. Summary will update on new commits.

Loading
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants